#include <iostream>
#include <cstring>
using namespace std;

class dog
{
public:
    dog(const char* name, int age) : age(age) // 等价于 this->name = name; this->age = age;
    {
        strcpy(this->name,name);
    }
    void show()
    {
        cout << "name: " << name << endl;
        cout << "age: " << age << endl;
    }
private:
    char name[20];
    int age;
};

int main()
{
    dog d1("小白", 2);
    d1.show();
    return 0;
}